package cn.tianya.irock.data.idal;

import java.util.List;

import cn.tianya.irock.data.model.Action;
import cn.tianya.irock.data.model.Page;
import cn.tianya.irock.data.model.Site;
import cn.tianya.irock.data.model.SiteSettings;
import cn.tianya.irock.data.model.Template;
import cn.tianya.irock.data.model.UrlPattern;
import cn.tianya.irock.enums.DataProviderAction;
import cn.tianya.irock.util.DataSet;

public interface ISiteSettingsDataProvider {
	List<Site> getPageSites(int pageId);
	List<Site> getSites(int settingsId);
	
	
	DataSet<Site> getSites(int pageIndex, int pageSize);
	DataSet<Page> getPages(int settingsId, int pageIndex, int pageSize);
	DataSet<UrlPattern> getUrlPatterns(int settingsId, int pageIndex, int pageSize);
	DataSet<Template> getTemplates(int pageIndex, int pageSize);
	DataSet<SiteSettings> getSettings(int pageIndex, int pageSize);
	DataSet<Action> getActions(int pageIndex, int pageSize);
	
	Site getSite(int siteId);
	Site getSite(String siteUrl);
	Site findSiteByname(String sitename);
	Action getAction(int pageId);
	Page getPage(int pageId);
	Template getTemplate(int settingsId, String page, String method);
	Template getTemplate(int tempId);
	String getTemplateContent(int tempId);
	UrlPattern getUrlPattern(int settingsId, int pageId, int actionId);
	
	int getSiteCount();
	int getActionCount();
	int getPageCount(int settingsId);
	int getTemplateCount();
		
	int createUpdateDeleteSite(Site site, DataProviderAction action);
	int createUpdateDeleteAction(Action action, DataProviderAction dpa);
	int createUpdateDeletePage(Page page, DataProviderAction action);
	int createUpdateDeleteTemplate(Template template, DataProviderAction action);
	int createUpdateDeleteUrlPattern(UrlPattern url, DataProviderAction action);
	int createUpdateDeleteSiteSettings(SiteSettings settings, DataProviderAction action);
	
	SiteSettings getSiteSettingsBySite(int siteId);
	SiteSettings getSiteSettings(int settingsId);
	void saveSiteSettings(SiteSettings siteSettings);
	void addPageToSiteSettings(Page page, int settingsId);
	void addSiteToSettings(int siteId, int settingsId);
	void updateSiteSettings(int siteId, int settingsId);
}
